//
//  RegBarsAppDelegate_iPad.m
//  RegBars
//
//  Created by Huu Nhat on 7/25/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "RegBarsAppDelegate_iPad.h"

@implementation RegBarsAppDelegate_iPad
@synthesize resBarDetailController;

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    stateViewController = [[StateListViewController_iPad alloc] initWithNibName:@"StateListViewController_iPad" bundle:nil];
    navViewController = [[UINavigationController alloc] initWithRootViewController:stateViewController];
//    [navViewController.navigationBar setHidden:YES];
    [navViewController.view setFrame:CGRectMake(0, 0, 768, 1024)];
	[self.window addSubview:navViewController.view];
    [navViewController.view addSubview:stateViewController.view];
    [stateViewController.view setFrame:CGRectMake(0, 0, 768, 1004)];
    [self.window addSubview:navViewController.view];
	[self.window makeKeyAndVisible];
	if ([self connectedToNetwork]) {
		[super application:application didFinishLaunchingWithOptions:launchOptions];
	}else {
		UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message" message:@"Connot connect internet, please check your network connection" delegate:nil cancelButtonTitle:@"Close" otherButtonTitles:nil];
		[alert show];
		[alert release];
	}
    resBarDetailController = [[RestaurantDetailViewController_iPad alloc] initWithNibName:@"RestaurantDetailViewController_iPad" bundle:[NSBundle mainBundle]];
	
	return YES;
}

- (void)dealloc {
    [stateViewController release];
    [navViewController release];
    [resBarDetailController release];
    [super dealloc];
}
@end
